﻿using System;
using System.Configuration;
using System.Collections.Generic;
using System.Text;

namespace AKMII.DMRA.DataLoader
{
    public abstract class Processor
    {
        public static Processor GetProcessor(string action)
        {
            string processor = ConfigurationManager.AppSettings[action];

            if (string.IsNullOrEmpty(processor))
            {
                throw new ArgumentException("unsupported command: " + action);
            }

            Type type = Type.GetType(processor);

            if (type == null)
            {
                throw new ApplicationException("non-configured command: " + action);
            }
            return (Processor)Activator.CreateInstance(type);
        }

        abstract public void Process(string source, string destination, string type);
    }
}
